using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using T2.Logging.Data.Controllers.Interfaces;
using T2.Logging.Data.Entities.Interfaces;
using T2.Logging.Business.Entities.Interfaces;
using T2.Logging.Business.Entities;
using T2.Logging.Business.Builders;
using T2.Logging.Business.Directors.Interface;
using T2.Logging.Business.Entities.Search.Interfaces;

//--Change Management Control - LogCategory Director  --**********************
//--Created By: trooks
//--Description: LogCategory Director Class
//--Created Date: 03/07/2013 10:05:34
//--*************************************************************

namespace T2.Logging.Business.Directors
{
	public partial class LogCategory_Director_biz : ILogCategory_director_biz
	{
		
		public List<ILogCategory_biz> Construct (ILogCategory_biz _param, bool BuildUp, bool BuildDown)
		{
			LogCategory_Builder build = new LogCategory_Builder();
			List<ILogCategory_biz> retVal = build.BuildParts(_param);
			foreach(ILogCategory_biz item in retVal)
			{
				item.Log_List = BuildLogList(item, false, BuildDown);
		}
			return retVal;
		}
		public List<ILogCategory_biz> Construct (ILogCategorySearch_biz _param, bool BuildUp, bool BuildDown)
		{
			LogCategory_Builder build = new LogCategory_Builder();
			List<ILogCategory_biz> retVal = build.BuildParts(_param);
			foreach(ILogCategory_biz item in retVal)
			{
				item.Log_List = BuildLogList(item, false, BuildDown);
		}
			return retVal;
		}
		private List<ILog_biz> BuildLogList(ILogCategory_biz _param, bool BuildUp, bool BuildDown)
		{
			List<ILog_biz> retVal = new List<ILog_biz>();
			if(BuildDown)
			{
			ILog_biz LogParam = new Log_biz();
			LogParam.Action ="LogCategory_Log_ByParent";
			LogParam.PageNumber = 1;
			LogParam.PageSize = 100;
			LogParam.SortType = "asc";
			LogParam.SortColumn = "LogID";
			LogParam.LogCategoryID = _param.LogCategoryID;
			Log_Builder builder = new Log_Builder();
			retVal = builder.BuildParts(LogParam);
			}
			return retVal;
		}
	}
}